package com.bjmashibing.system.huawei.domain;

/**
 * @Classname Person
 * @Description TODO
 * @Date 2020/9/26/026 16:37
 * @Created by Administrator
 */
public class Person {
    private String name;
    private int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    public int hashCode() {

        return name.hashCode() + age * 10;

    }

    public boolean equals(Object obj) {

        if (!(obj instanceof Person))

            throw new ClassCastException("类型不匹配");

        Person p = (Person) obj;

        return this.name.equals(p.getName()) && this.age == p.getAge();

    }
}
